package org.spark.api.util.model;

import java.util.HashMap;
import java.util.Map;

/**
 * @author chenwy
 */
public class HBaseClassMapping {

    private Map<String, HBaseColumnMapping> fields;

    private HBaseClassMapping(Map<String, HBaseColumnMapping> fields) {
        this.fields = fields;
    }

    public static HBaseClassMapping.Builder builder() {
        return new HBaseClassMapping.Builder();
    }

    public static final class Builder {

        public final Map<String, HBaseColumnMapping> fields = new HashMap<>();

        public HBaseClassMapping.Builder put(String key, HBaseColumnMapping columnFilter) {
            fields.put(key, columnFilter);
            return this;
        }

        public HBaseClassMapping build() {
            return new HBaseClassMapping(fields);
        }
    }

    public boolean containsKey(String key) {
        return fields.containsKey(key);
    }

    public HBaseColumnMapping get(String key) {
        return fields.get(key);
    }

    public Map<String, HBaseColumnMapping> getAll(){
        return fields;
    }

}
